package com.shopx.base.aspect;

import com.alibaba.fastjson.JSONObject;
import com.shopx.base.anno.ShopxParamAnno;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class ShopxParamAspect {
    @Before("@annotation(anno)")
    public void before(JoinPoint join, ShopxParamAnno anno) {
        Object[] args = join.getArgs();
        for (Object arg : args) {
            log.info("请求参数：{}", JSONObject.toJSONString(arg));
        }
    }
}
